package com.han.factory.after.factory_method;


/**
 * @ClassName CoffeeStore
 * @Description 描述该类的功能
 * @Author duoduo Han
 * @Date 2024/6/4 10:14
 */
public class CoffeeStore {
    private CoffeeFactory factory;

    public CoffeeStore() {
    }

    public CoffeeStore(CoffeeFactory factory) {
        this.factory = factory;
    }


    public void setFactory(CoffeeFactory factory) {
        this.factory = factory;
    }

    //点咖啡功能
    public Coffee orderCoffee() {
        Coffee coffee = factory.createCoffee();
        //加配料
        coffee.addSugar();
        coffee.addMilk();
        return coffee;
    }
}
